-
Notifications
You must be signed in to change notification settings - Fork 1k
samples(StorageControl): Add sample for anywhereCache #2143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
samples(StorageControl): Add sample for anywhereCache #2143
Conversation
Here is the summary of changes. You are about to add 7 region tags.
This comment is generated by snippet-bot.
|
@bshaffer Just a reminder—when you have time, please take a look at this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These samples look good, but it would be nice if we had some basic testing around them!
Anywhere cache creation is a long-running operation, the test was not added for all languages as discussed. |
// completes. | ||
$response = $storageControlClient->createAnywhereCache($request); | ||
|
||
printf('Created anywhere cache: %s', $response->getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these responses are operations (because they are longrunning), so this is incorrect.
I would suggest either calling the $response
variable an $operation
, or waiting for it to complete like this:
$operation->pollUntilComplete();
$cache = $operation->getResult();
printf('Created anywhere cache: %s', $cache->getName());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retrieve the cache name using the operation pollUntilComplete
method.
$operation = $storageControlClient->createAnywhereCache($request);
$operation->pollUntilComplete([
'totalPollTimeoutMillis' => 5400000,
'initialPollDelayMillis' => 1000, // Start with 1 second delay
'pollDelayMultiplier' => 2, // Double delay each time
'maxPollDelayMillis' => 60000, // Max 60 seconds delay between polls
]);
/** @var AnywhereCache $anywhereCacheResult */
$anywhereCacheResult = $operation->getResult();
printf('Created anywhere cache: %s' . PHP_EOL, $anywhereCacheResult->getName());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess would be the only required configuration of the above is totalPollTimeoutMillis
, but the others may be nice to have there as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bshaffer I hope the test cases are working well. Is it okay to approve them, or do we need to add more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran these tests and they all passed. Great job!
This PR adds sample code for the anywhere cache feature, allowing users to: